const joi = require('joi')


//姓名的正则
const id = joi.required()
const name = joi.string().pattern(/^[\u4E00-\u9FA5]{2,10}(.[\u4E00-\u9FA5]{2,10}){0,2}$/).required()
//邮箱
const email = joi.string().pattern(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/).required()
const oldPassword=joi.string().pattern(/^[a-zA-Z0-9]+$/).min(6).max(12).required()
const newPassword=joi.string().pattern(/^[a-zA-Z0-9]+$/).min(6).max(12).required()

exports.password_limit = {
	//表示对req.body里面的数据进行验证
	body: {
		id,
		oldPassword,
		newPassword,
	}
}


exports.name_limit = {
	//表示对req.body里面的数据进行验证
	body: {
		id,
		name,
	}
}

exports.email_limit = {
	//表示对req.body里面的数据进行验证
	body: {
		id,
		email,
	}
}

exports.forgetPassword_limit = {
	//表示对req.body里面的数据进行验证
	body: {
		id,		
		newPassword,
	}
}